<template>
	<view class="nodata-wrap">
		<image class="nodata-img" src="/static/img/nodata.png"></image>
		<text v-if="token" class="nodata-text" >没有更多数据啦~</text>
		<view v-else>
			<text class="nodata-text">点击登录查看更多数据</text>
			<view class="btn-row">
				<button class="cu-btn  block bg-blue margin-tb-sm lg" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">微信登录</button>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getStorage,
		setStorage,
		showModal
	} from '@/utils/util.js';
	import {
		loginFn
	} from "@/utils/common.js";
	export default {
		props: {
			token: String,
		},
		data() {
			return {
				login_code: '',
			}
		},
		computed: {
			// getTypeVal(){
			// 	return ocrTypeFormate(this.type,this.ocrList);
			// }
		},
		onLoad: function() {

		},
		methods: {
			getPhoneNumber(e) {
				if (e.detail.errMsg !== "getPhoneNumber:ok") {
					// goPage(pages.goGegister);
					return;
				}
				uni.login({
					success: (res) => {
						const {
							code
						} = res;
						if (!code) {
							showModal({
								content: "code获取失败",
								showCancel: false
							});
							return;
						}
						loginFn({
							props: {store:this.$store,appid:this.appid,secret:this.secret},
							callback:(res) => {
								console.log('返回数据')
								//登录成功后刷新当前页面
								uni.reLaunch({
									url:"/pages/search/searchList"
								})
							}
						})
					}
				});
			},
		}
	}
</script>

<style>
	.nodata-wrap {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		margin-top: 100px;
	}

	.nodata-img {
		width: 100px;
		height: 100px;
		margin-bottom: 10px;
	}

	.nodata-text {
		font-size: 18px;
		color: #333;
	}

	.btn-row {
		padding: 0
	}

	.cu-btn.lg {
		border-radius: 50px;
	}
</style>
